package org.neuedu.chapter07_0624.mydemo01;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择：");
        System.out.println("1-----查询用户信息");
        System.out.println("2-----修改用户年龄");
        String option = scanner.nextLine();
        StudentDao dao = new StudentDaoImpl();
        Student stu = null;
        switch (option) {
            case "1":
                System.out.println("请输入学生姓名");
                String name = scanner.nextLine();
                stu = dao.getInfos(name);
                break;
            case "2":
                System.out.println("请输入学生姓名");
                String name1 = scanner.nextLine();
                System.out.println("请输入年龄");
                int age1 = scanner.nextInt();
                Student stu1 = new Student();
                stu1.setName(name1);
                stu1.setAge(age1);
                stu = dao.updateInfos(stu1);
                break;
        }

        if (stu == null) {
            System.out.println("查无此人");
        }else{
            System.out.println(stu.getName());
            System.out.println(stu.getAge());
            System.out.println(stu.getNation());
            System.out.println(stu.isGender());
        }
    }
}
